package top.songxs.gmall.web.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import top.songxs.gmall.feign.order.OrderFeignClient;
import top.songxs.gmall.order.entity.OrderInfo;

@Controller
@Slf4j
public class PayController {

    @Autowired
    private OrderFeignClient orderFeignClient;
    @GetMapping(value = "/pay.html")
    public String payConfirmPage(@RequestParam(value = "orderId") Long orderId, Model model){
        OrderInfo orderInfo = orderFeignClient.findById(orderId).getData();
        model.addAttribute("orderInfo", orderInfo);

        return "payment/pay";
    }
    @GetMapping(value = "/payment/success.html")
    public String success(){
        return "payment/success";
    }
}
